import {action,observable} from 'mobx'
import {getSearch,getHotList} from "../../services/search"
import {Detail,rankDetail} from "../../services/home"
class Search{
    @observable
    list=[];

    @observable
    articleList=[]

    @observable
    hotList=[]

    @observable
    rankDataList=[]

    @observable
    dropList=[]

    @observable
    rankItemGroup=[]

    @observable
    rankItemList=[]

    @action
    async getSearch(str) {
        let arr = await getSearch(str)
        this.list=arr.data.rankList
        this.articleList=arr.data.articleList
    }

    @action
    async searchHotList(){
        let arr=await getHotList()
        this.hotList=arr.data.dataList
    }

    @action
    async myDetail(str){
        let arr = await Detail(str)
        let brr = await rankDetail(str)
        this.rankDataList=arr.data.rankDataList
        this.dropList=brr.data.dropList
        this.rankItemGroup=brr.data.rankItemGroup
        this.rankItemList=brr.data.rankItemList
    }

    @action
    async myFilter(id,cityid){
        let arr = await Detail(id,cityid)
         this.rankDataList=arr.data.rankDataList
    }
  
}
export default Search